package com.github.slprj.slake.net;

/**
 * 主机的地址和端口
 *
 * @author YangXiaoLong
 * @date 2022/9/6 12:29
 */
public class HostPort {
    private final String host;
    private final int port;
    private String toStr;

    public HostPort(String host, int port) {
        this.host = host;
        this.port = port;
    }

    public String getHost() {
        return host;
    }

    public int getPort() {
        return port;
    }

    @Override
    public String toString() {
        if (toStr == null) {
            return toStr = "[" + host + "," + port + "]";
        }
        return toStr;
    }
}
